from MainADM import *
from MainATE import *
from MainTEC import *
import MySQLdb


##############################################################
#                           LOGIN                            #
##############################################################
def Login():
    Login = raw_input("Login: ")
    Senha = raw_input("Senha: ")
    verificarLogin(Login,Senha)

def verificarLogin(Login,Senha):
    db = MySQLdb.connect("localhost","root","","gtec" )
    cursor = db.cursor()
    comando = """ SELECT * FROM usuario WHERE login = "%s" """%(Login)
    cursor.execute(comando)
    pesq = cursor.fetchall()
    for coluna in pesq:
        if coluna[1] == Login and coluna[2] == Senha:
            if coluna[3] == "ADM":
                mainADM()
            if coluna[3] == "ATE":
                mainATE()
            if coluna[3] == "TEC":
                mainTEC()
    db.commit()

Login()
